package com.qf.mao.dao;

import com.qf.mao.entity.User;
import com.qf.mao.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * @author 啾咪小魔王
 * @date 2022/4/6 10:15
 * @since JDK 1.8
 */@SuppressWarnings("all")
public class UserDao {
     private QueryRunner queryRunner =new QueryRunner(DBUtils.getDataSource());
     public User getUserByName(String username) throws SQLException {
         return queryRunner.query("select * from user where username=?",new BeanHandler<>(User.class),username);
     }
}
